﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Tanmia.Core;
using FluentNHibernate.Mapping;

namespace Tanmia.NHibernate.Mapping
{
    public class DiscriminatedItemMap : ClassMap<DiscriminatedItem>
    {
        public DiscriminatedItemMap()
        {
            Table("DiscriminatedItem");

            Id(x => x.DiscriminatedItemID).Not.Nullable().GeneratedBy.Identity();

            Map(x => x.Cost).Not.Nullable().Default("0");
            Map(x => x.Price).Not.Nullable().Default("0");
            Map(x => x.CreateDate).Not.Nullable().Not.Update();
            Map(x => x.Note).Length(2048).Nullable();

            References(x => x.Item, "ItemID").Not.Nullable();
            References(x => x.Color, "ColorID").Not.Nullable();
            References(x => x.Unit, "UnitID").Not.Nullable();
            References(x => x.Manufacturer, "PersonID").Not.Nullable();
        }
    }
}
